package lee.study.TestSort;

import java.util.Arrays;

public class insertSort {
    public static void inserSort(int[] array) {
        int tmp = 0;
        for (int i = 1; i < array.length; i++) {
            int j;
            tmp = array[i];
            for (j = i - 1; j >= 0; j--) {
                if (array[j] > tmp) {
                    array[j + 1] = array[j];
                }else {
                    break;
                }
            }
            array[j + 1] = tmp;
        }
    }

    public static void main(String[] args) {
    int[] array={1,7,3,9,2,0,22,99,24,63};
    inserSort(array);
        System.out.println(Arrays.toString(array));
    }
}
